#include "sksegment.h"
#include "skline.h"
#include "skpoint.h"

SkSegment::SkSegment(const int& id,const QList<QPointF>& points,QGraphicsItem * parent):
        QGraphicsWidget(parent),SkIdAble(id),skPoints(points)
{

    setZValue(-2);
    //teraz trzeba wszystko polaczyc
    SkPoint* last = new SkPoint(1,skPoints.at(0),6,this);
    for(int i=1;i<skPoints.size();i++){
        SkPoint* n2 = new SkPoint(2,skPoints.at(i),6,this);
        new SkLine(1,last,n2,this);
        last=n2;
    }
}
SkSegment::SkSegment(int id, QList<SkPoint*>& points,QGraphicsItem * parent):
		QGraphicsWidget(parent),SkIdAble(id),pnts(points)
{
    setZValue(-2);
    //teraz trzeba wszystko polaczyc
    SkPoint* last = pnts.at(0);
    for(int i=1;i<pnts.size();i++){
        SkPoint* n2 = pnts.at(i);
        new SkLine(101,last,n2,this);
        last=n2;
    }
}
